package online.sixfish.doubao.controller.admin;

import lombok.extern.slf4j.Slf4j;
import online.sixfish.common.api.ApiResult;
import online.sixfish.doubao.model.dto.LoginDTO;
import online.sixfish.doubao.service.AdminService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Collections;
@CrossOrigin
@RestController
@Slf4j
public class AdminController {
    @Resource
    AdminService adminService;

    @PostMapping("/admin/login")
    public ApiResult adminLogin(@RequestBody LoginDTO loginDTO){
        String token = adminService.login(loginDTO);
        return ApiResult.success(Collections.singletonMap("token",token));
    }
}
